import 'package:flutter/material.dart';

import '../../nav/nav_route.dart';
import '../../utils/res_images.dart';
import '../../utils/res_strings.dart';
import '../../utils/screen_adapter.dart';
import '../../widget/title_bar.dart';
import '../../widget/title_bar_sub.dart';

/// 
/// @Description 
/// @Author WuJianFeng
/// @Date 2024/3/18 17:45
/// 

class PersonalCenter extends StatefulWidget{
  const PersonalCenter({super.key});

  @override
  State<StatefulWidget> createState() => _PersonalCenterState();
  
}

class _PersonalCenterState extends State<PersonalCenter>{


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
            image: DecorationImage(
                image: ImageUtils.getImageProvider("gradient_bg.webp"),
                fit: BoxFit.fill,
                alignment: Alignment.bottomCenter
            )
        ),
        child: Stack(
          children: [

            /// 标题布局
            Positioned(
              child: Align(
                alignment: Alignment.topCenter,
                child: Column(
                  children: [
                    /// 标题
                    const TitleBarWidget(),
                    /// 副标题
                    TitleBarSub(sTitlePersonalCenter),
                  ],
                )
              ),
            ),

            ///底部背景
            Positioned(
              child: Align(
                alignment: Alignment.bottomCenter,
                child: ImageUtils.getImgWithSize("personal_center_bg.webp",1920,497),
              ),
            ),

            ///中间内容
            Positioned.fill(
              left: Adapt.pt(286),
              child: Align(
                alignment: Alignment.center,
                child: Row(
                  children: [
                    ///待缴费处方
                    InkWell(
                      onTap: (){
                        Navigator.pushNamed(context, routerPayWait);
                      },
                      child: ImageUtils.getImgWithSize("personal_center_wait_pay.webp",443,554),
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        ///站点检测记录
                        centerItemWidget("personal_center_site.webp","站点检测记录"),
                        ///挂号记录
                        centerItemWidget("personal_center_registered.webp","挂号记录"),
                      ],
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        ///账户信息
                        centerItemWidget("personal_center_account.webp","账户信息"),
                        ///咨询记录
                        centerItemWidget("personal_center_consult.webp","咨询记录"),
                      ],
                    ),
                  ],
                ),
              ),
            ),

          ],
        ),
      ),
    );
  }

  Widget centerItemWidget(String imgName, String content){
    return Stack(
      children: [
        Positioned(
          child: Align(
            child: ImageUtils.getImg(imgName),
          ),
        ),
        Positioned.fill(
          child: Align(
            alignment: Alignment.center,
            child: Text(content, style: TextStyle(fontSize: Adapt.pt(40), color: Colors.white, fontWeight: FontWeight.bold)),
          ),
        ),
      ],
    );
  }
  
}
 
 